package com.hanliy.utils;

/**
 * @author hanyulin
 * @apiNote
 * @date 2022/2/8 14:26
 */

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;

/**
 * @author hanyulin
 * @apiNote 编号生成类
 * @date 2022/2/7 16:44
 */
public class OrderCodeUtils {

    /**
     * 生成预下单订单号
     *
     * @date 2022/2/7 16:46
     * @return java.lang.String
     */
    public static String builderOrderNo(){
        return "G" + getRandom();
    }

    /**
     * 生成编号
     *
     * @date 2022/2/7 16:45
     * @return java.lang.String
     */
    public static String getRandom() {
        Snowflake snowflake = IdUtil.getSnowflake(1, 1);
        String uuid = String.valueOf(snowflake.nextId());
        return uuid;
    }
}

